/**
  ******************************************************************************
  * @file    GPIO.c 
  * @author  MCU SD
  * @version V1.0
  * @date    16-Nov-2015
  * @brief   
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "pin_config.h"

/* Private functions ---------------------------------------------------------*/
void app_GPIO_Init(uint8_t GPIOx, uint8_t PINx, uint8_t Direct, uint8_t PullEnable)
{
	gpio_init(GPIOx, PINx, 0);									//????????????????????,GPIO???????????gpio
	if(0 == Direct)
	{
		gpio_dir(GPIOx, PINx, GPIO_DIR_IN);						//????????? 
		gpio_in_enable(GPIOx, PINx, ENABLE);					//???????
	}
	else
	{
		gpio_dir(GPIOx, PINx, GPIO_DIR_OUT);					//????????
		gpio_config_od(GPIOx, PINx, DISABLE);					//???OD???
	}
	if(0 == PullEnable)
	{
		gpio_config_pu(GPIOx, PINx, DISABLE);					//???????
	}
	else
	{
		gpio_config_pu(GPIOx, PINx, ENABLE);					//???????
	}
	gpio_config_pd(GPIOx, PINx, DISABLE);						//???????
}

void app_GPIO_Set_PinState(uint8_t GPIOx, uint8_t PINx, uint8_t PinState)
{
	uint8_t setPinState;

	if(PinState == 0)
	{
		setPinState = LOW;
	}
	else
	{
		setPinState = HIGH;
	}
	gpio_setio(GPIOx, PINx, setPinState);
}

uint8_t app_GPIO_Get_PinState(uint8_t GPIOx, uint8_t PINx)
{
	uint8_t getPinState;
	getPinState = gpio_read_io(GPIOx, PINx);
	if(getPinState == LOW)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

void Other_GPIO_Configuration(void){
    //init gpio
}
/******************* (C) COPYRIGHT 2015 GIGADEVICE *****END OF FILE****/

